/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dtd.to.xml;

import java.util.Objects;

/**
 * Class which represents entity in DTD document
 * @author martin
 */
public class DTDEntity {
    private final String name;
    private final String value;
    
    /**
     * Constructor for class DTDEntity
     * @param newName name of Entity
     * @param newValue value of Entity
     */
    public DTDEntity(String newName , String newValue){
        name = newName;
        value = newValue.substring(1, newValue.length() - 1);
    }
    
    /**
     * Getter
     * @return name of Entity
     */
    public String getName(){
        return name;
    }
    
    /**
     * Getter
     * @return value of Entity
     */
    public String getValue(){
        return value;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 71 * hash + Objects.hashCode(this.name);
        hash = 71 * hash + Objects.hashCode(this.value);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final DTDEntity other = (DTDEntity) obj;
        if (!Objects.equals(this.name, other.name)) {
            return false;
        }
        if (!Objects.equals(this.value, other.value)) {
            return false;
        }
        return true;
    }
}
